<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{$config_sitename}</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="__CSS__/usersh.css?t={$ver}" rel="stylesheet">
</head>
<body class="msg-pad cl-b-lgrey nofoot">
	<div class="loading-wrapper">
		<div class="loading"></div>
	</div>
	<div class="ub ub-ac page-header">
		<a href="javascript:history.back();" class="clickable"><span class="icon-back"></span></a>
		<div class="ub-f1 page-name">写邮件</div>
		<a href="javascript:;" class="clickable-deep cl-f-white cl-b-lorange write-mail-submit mail-send" data-type="yes">
			发送
		</a>
	</div>
	<form class="write-mail-form" data-url="__WEBURL__/weixin/user/sendmail">
		<input type="text" class="form-control" value="烘焙圈" placeholder="@烘焙圈" readonly>
		<input type="text" class="form-control" name="title" placeholder="请输入邮件主题">
		<textarea class="form-control" name="content" placeholder="请输入邮件内容"></textarea>
	</form>
	
	<script src="__JS__/jquery-1.11.1.min.js?t={$ver}"></script>
	<script src="__JS__/jquery.lazyload.min.js?t={$ver}"></script>
    <script src="__JS__/custom.js?t={$ver}"></script>
    <script src="__JS__/post.js?t={$ver}"></script>
    <script src="__JS__/common.js?t={$ver}"></script>
    <script>
    $(function(){
        $('.mail-send').click(function(e){
        	var url = $('.write-mail-form').attr('data-url');
    		if(url == undefined || url == '')
    		{
    			showToast('配置错误');
    			return false;
    		}
    		var data = getPostData('write-mail-form');
    		var _this = $(this);
    		var type = _this.attr('data-type');
    		if(type == 'yes')
    		{
    			_this.attr('data-type', 'no');
        		$.ajax({
        		    url: url,
        		    type: 'POST',
        		    dataType: 'json',
        		    data: data,
        		    success: function(res){
            		    showToast(res.info);
            		    if(res.status == 1)
            		    {
                		    setTimeout(function(){
                		        location.href = res.url;
                		    }, 2000);
            		    }
            		    _this.attr('data-type', 'yes');
        		    },
        		    error: function(res){
        		        showToast('系统繁忙');
        		    }
        		});
    		}
    		else
    		{
        		showToast('发送中,请稍候');
    		}
        });
    });
    </script>
</body>
</html>